package com.odais.mvc.seller;

import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.TextView;

import com.odais.R;

/**
 *
 * @author Lionel DECELLE
 * @since 8 juin 2012 - 10:54:08
 *
 */
public class sellerListViewMain extends TabActivity{

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sellerlistviewmain);

        //tabhost declaration
        TabHost tabHost = getTabHost();
        TabHost.TabSpec spec;
        Intent intent;

        tabHost.setup();

        TabWidget tw = tabHost.getTabWidget();
        tw.setOrientation(LinearLayout.VERTICAL);


        //Pending list view
        intent = new Intent().setClass(this, sellerListViewPending.class);
        spec = tabHost.newTabSpec("SellerLVPending").setIndicator(createIndicatorView(tabHost, "Pending")).setContent(intent);
        tabHost.addTab(spec);

        //History
        intent = new Intent().setClass(this, sellerListViewHist.class);
        spec = tabHost.newTabSpec("SellerLVHistory").setIndicator(createIndicatorView(tabHost, "History")).setContent(intent);
        tabHost.addTab(spec);


        tabHost.setCurrentTab(0);
    }

	private View createIndicatorView(TabHost tabHost, CharSequence label) {
		// Defining a vertically stacked tablayout
       LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

       View tabIndicator = inflater.inflate(R.layout.tab_indicator,
               tabHost.getTabWidget(), // tab widget is the parent
               false); // no inflate params

       final TextView tv = (TextView) tabIndicator.findViewById(R.id.title);
       tv.setText(label);

       //final ImageView iconView = (ImageView) tabIndicator.findViewById(R.id.icon);
       //iconView.setImageDrawable(icon);

       return tabIndicator;
   }
}